class Redprint:
    def __init__(self, name):
        self.name = name
        self.mound = []

    def route(self, rule, **options):
        def decorator(f):
            endpoint = options.pop("endpoint", f.__name__)
            endpoint = self.name + '+' + endpoint
            # v1.super_get_user
            # v1.user+super_get_user
            self.mound.append((rule, endpoint, f, options))
            return f

        return decorator

    def register(self, bp, url_prefix=None):
        if url_prefix is None:
            url_prefix = '/' + self.name
        for rule, endpoint, f, options in self.mound:
            rule = url_prefix + rule
            bp.add_url_rule(rule, endpoint, f, **options)

# 基础知识
# ** 就是拆包
# **options 接受的是 可变的关键参数

# route(self, rule, a =1 ,b =2 , c=3)
#
# options = {'a':1, 'b':2,'c':3}
